#include "ufcs_driver.h"
#include "usart.h"
uint8_t ufcs_recv_idx = 0;
uint8_t ufcs_recv_buff[128] = { 0 };

void UFCS_CMD_Proc(PowerV_CMD *powerv_cmd)
{
	switch(powerv_cmd -> cmd)
	{
		case 0x00:
			powerv_cmd -> result = UFCS_Shake_Hand();
			powerv_cmd -> para_len = 0;
			CMD_Response(powerv_cmd);
			break;
		case 0x01:
            powerv_cmd -> result = 0;
			powerv_cmd -> para_len = UFCS_Get_Output_Cap(powerv_cmd -> para);
			CMD_Response(powerv_cmd);
			break;
		case 0x02:
			powerv_cmd -> result = UFCS_Request(powerv_cmd -> para[0],
                                                powerv_cmd -> para[1] * 256 + powerv_cmd -> para[2],
                                                powerv_cmd -> para[3] * 256 + powerv_cmd -> para[4]);
            powerv_cmd -> para_len = 0;
			CMD_Response(powerv_cmd);
			break;
		case 0x03:
            powerv_cmd -> result = 0;
			powerv_cmd -> para_len = Get_Source_Info(powerv_cmd -> para);
			CMD_Response(powerv_cmd);
			break;
		case 0x0F:
			powerv_cmd -> result = UFCS_Exit();
            powerv_cmd -> para_len = 0;
			CMD_Response(powerv_cmd);
			break;
		default:
			break;
	}
}

